package com.kreateinfinity.msdi.service.authentication.impl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kreateinfinity.msdi.dao.authentication.UserAuthenticationDAO;
import com.kreateinfinity.msdi.model.authentication.User;
import com.kreateinfinity.msdi.service.authentication.UserAuthenticationService;

@Service("userAuthenticationService")
public class UserAuthenticationServiceImpl implements UserAuthenticationService {
	@Autowired
	UserAuthenticationDAO userAuthenticationDAO;


	// User Authentication DAO
	//private UserAuthenticationDAO userAuthenticationDAO = null;

	@Override
	public void doLogout(HttpServletRequest request) {
		HttpSession session = request.getSession();
		if (session != null) {
			session.invalidate();
		}
	}

	public User getLogin(String userName, String password){
		System.out.println("test point 11");
		return userAuthenticationDAO.getLogin(userName, password);
	}


	public UserAuthenticationDAO getUserAuthenticationDAO() {
		return userAuthenticationDAO;
	}

	public void setUserAuthenticationDAO(UserAuthenticationDAO userAuthenticationDAO) {
		this.userAuthenticationDAO = userAuthenticationDAO;
	}
}
